package org.jiamandan.com.strategy.enums;


import org.jiamandan.com.constant.DXConstant;

public enum DXEventTagEnum {
    //读设备地址，序列号
    CMD_002(DXConstant.Cmd.CMD_002, DXConstant.Service.CMD_002),
    //桩心跳包
    CMD_082(DXConstant.Cmd.CMD_082, DXConstant.Service.CMD_082),
    CMD_004(DXConstant.Cmd.CMD_004, DXConstant.Service.CMD_004),
    CMD_084(DXConstant.Cmd.CMD_084, DXConstant.Service.CMD_084),
    CMD_008(DXConstant.Cmd.CMD_008, DXConstant.Service.CMD_008),
    CMD_088(DXConstant.Cmd.CMD_088, DXConstant.Service.CMD_088),
    CMD_009(DXConstant.Cmd.CMD_009, DXConstant.Service.CMD_009),
    CMD_089(DXConstant.Cmd.CMD_089, DXConstant.Service.CMD_089),
    CMD_A01(DXConstant.Cmd.CMD_A01, DXConstant.Service.CMD_A01),
    CMD_A02(DXConstant.Cmd.CMD_A02, DXConstant.Service.CMD_A02),
    CMD_A03(DXConstant.Cmd.CMD_A03, DXConstant.Service.CMD_A03),

    CMD_A04(DXConstant.Cmd.CMD_A04, DXConstant.Service.CMD_A04),

    CMD_A80(DXConstant.Cmd.CMD_A80, DXConstant.Service.CMD_A80),
    CMD_ACO(DXConstant.Cmd.CMD_AC0, DXConstant.Service.CMD_AC0),
    CMD_AC1(DXConstant.Cmd.CMD_AC1, DXConstant.Service.CMD_AC1),
    CMD_901(DXConstant.Cmd.CMD_901, DXConstant.Service.CMD_901),
    CMD_902(DXConstant.Cmd.CMD_902, DXConstant.Service.CMD_902),
    CMD_F01(DXConstant.Cmd.CMD_F01, DXConstant.Service.CMD_F01),
    CMD_F03(DXConstant.Cmd.CMD_F03, DXConstant.Service.CMD_F03);

    private String key;

    private String value;

    DXEventTagEnum(String key, String index) {
        this.key = key;
        this.value = index;
    }

    public String getKey() {
        return key;
    }

    public void setKey(String key) {
        this.key = key;
    }

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }

    //通过key-获取value
    public static String getValueByKey(String key) {
        for (DXEventTagEnum contextEnum : DXEventTagEnum.values()) {
            if (key.equals(contextEnum.key)) {
                return contextEnum.getValue();
            }
        }
        return "";
    }

    //通过vale-获取key
    public static String getKeyByValue(String value) {
        for (DXEventTagEnum contextEnum : DXEventTagEnum.values()) {
            if (value.equals(contextEnum.value)) {
                return contextEnum.getKey();
            }
        }
        return "0";
    }
}
